//函数防抖
export default function(fn,duration = 100){
    let timer = null;
    return (...args) =>{
        if(timer !== null){
            clearTimeout(timer);
        }
        timer = setTimeout(()=>{
            fn(...args);
        },duration)
    }
}